package com.tarena.test.luban.demo.stock.dubbo;

import com.tarena.demo.luban.all.main.rpc.DubboTestApiImpl;
import com.tarena.luban.demo.stock.api.DubboTestApi;
import org.apache.dubbo.config.ProtocolConfig;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.ServiceConfig;
import org.apache.dubbo.config.bootstrap.DubboBootstrap;

public class DubboProvider {
    public static void main(String[] args) {
        ServiceConfig<DubboTestApi> providerService = new ServiceConfig<>();
        providerService.setInterface(DubboTestApi.class);
        providerService.setRef(new DubboTestApiImpl());
        DubboBootstrap boot = DubboBootstrap.getInstance();
        boot.application("stock-provider");
        boot.registry(new RegistryConfig("nacos://localhost:8848"));
        boot.protocol(new ProtocolConfig("dubbo",20990));
        boot.service(providerService);
        boot.start().await();

    }
}
